const express = require('express');
const router = express.Router();
const todoController = require('../controllers/todoControllers');

router.get('/', 
    /* 	#swagger.tags = ['Todo']
        #swagger.description = '取得所有待办事项' */
     /* #swagger.responses[200] = { 
      schema: [
          {
            "id": "d88ced21-f0a7-42b3-befa-440ecdde98fb",
            "title": "预设资料",
            "completed": false
          }
        ],
      description: "取得所有待办事项成功." } */
    todoController.getAllTodos);
 
router.get('/:id', todoController.getTodoById);
// create todo
router.post('/',
    /* 	#swagger.tags = ['Todo']
        #swagger.description = '新增待办事项' */
    /* #swagger.parameters['body'] = {
        in: 'body',
        description: '新增待办事项',
        schema: {
            type: 'object',
            properties: {
                title: {
                    type: 'string',
                    description: '待办事项标题'
                },
                completed: {
                    type: 'boolean',
                    description: '待办事项是否完成'
                }
            }
        }
    } */
     /* #swagger.responses[200] = { 
      schema:{
            "id": "d88ced21-f0a7-42b3-befa-440ecdde98fb",
            "title": "预设资料",
            "completed": false
        },
      description: "新增待办事项成功." } */
    todoController.createTodo);

router.put('/:id', todoController.updateTodo);

router.delete('/:id', todoController.deleteTodo);

module.exports = router;
